function getStyle(obj,attr){
	return obj.currentStyle ? obj.currentStyle[attr] : getComputedStyle(obj,1)[attr];
}
function sport(obj,json,fn){
	//1.清除计时器
	clearInterval(obj.timer);
	//2.开启新的计时器
	obj.timer = setInterval(function(){
		var stop = true;
		for(var attr in json){
			//1.获取当前值
			var cur = 0;
			if(attr === 'opacity'){
				cur = parseInt(parseFloat(getStyle(obj,attr)) * 100);
			}else{
				cur = parseInt(getStyle(obj,attr));
			}
			//2.计算速度 
			var speed = (json[attr] - cur) / 8;
			speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);
			//3.判断是否全部达到目标
			if(json[attr] != cur){
				stop = false;
			}
			//4.运动 
			if(attr == 'opacity'){
				obj.style.opacity = (cur + speed) / 100;
				obj.style.filter = "alpha(opacity=" + (cur + speed) + ")";
			}else{
				obj.style[attr] = cur + speed + "px";
			}
		}
		if(stop){
			clearInterval(obj.timer);
			if(typeof fn == 'function'){
				fn();
			}
		}
	},30);
}
